<script lang="ts" setup>

const props = defineProps({
  show: {
    type: Boolean,
    default: false,
  },
  id: {
    type: Number,
    default: 0,
  },
});

const emits = defineEmits([ "update:show" ]);
const onClose = () => {
  emits("update:show", false);
};
let userGroupId = computed(() => {
  return props.id
})
const toLink = () => {
  ElMessage.info(`编辑后记得重新刷新页面哦～`);
  const href = window.location.href.split("#/")[0];
  window.open(href + '#/merchant/customerCenter/customerGroup/customerDetail/' + userGroupId.value + '?type=0', '_blank')
}
</script>
<template>
  <el-dialog
    :model-value="show"
    title="测试名单"
    :width="880"
    @close="onClose"
  >
    <div class="button">
      <el-button
        type="primary"
        @click="toLink"
      >
        去编辑
      </el-button>
    </div>
    <LayoutTable
      ref="customerClient"
      :row-key="(row) => {
        return String(row.id);
      }
      "
      url="/user/userGroupUser/pageList"
      :param="{userGroupId}"
    >
      <el-table-column
        prop="userId"
        label="用户ID"
        width="180"
      />
      <el-table-column
        prop="phone"
        label="手机号"
        width="150"
      />
      <el-table-column
        prop="unionId"
        label="唯一标识"
        min-width="150"
      />
      <el-table-column
        prop="merchantAdminUserName"
        label="导入人"
        min-width="100"
      />
      <el-table-column
        prop="createTime"
        label="导入时间"
        width="180"
      >
        <template #default="scope">
          <div>
            {{ $filters.dateFormat(scope.row.createTime) }}
          </div>
        </template>
      </el-table-column>
    </LayoutTable>
  </el-dialog>
</template>
<style lang="scss" scope>
.button{
  width: 100%;
  display: flex;
  margin-bottom: 10px;
}
</style>
